<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html>

	<head>
		<title>物资管理系统</title>
		<meta charset="utf-8">
		<link rel="icon" href="<%=basePath %>images/vone_icon.ico" type="image/x-icon" />
		<link rel="stylesheet" href="libs/bootstrap-3.3.7-dist/css/bootstrap.min.css">
		<link rel="stylesheet" href="<%=basePath %>css/reset.css">
		<link rel="stylesheet" href="<%=basePath %>css/style.css">
		<link rel="stylesheet" href="<%=basePath %>css/index.css">
		<style>
			.input {
				display: inline-block;
				width: 180px;
				margin-left: 10px;
			}
			iframe{
				width:100%;
				height:800px;
			}
			.row {}
			a {cursor:pointer;}
		</style>
	</head>

	<body>
		<div class="page">
			<header class="header clearfix">
				<div class="system_info">
					<a><img src="images/logo.png" alt="" class="system_logo"></a>
					<div class="dropdown system_name">
						<button class="btn btn-default dropdown-toggle" type="button" id="system_name" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
						物资管理系统
						<span class="caret"></span>
					</button>
						<ul class="dropdown-menu" aria-labelledby="system_name">
							<li>
								<a href="<%=basePath %>index">物资管理系统</a>
							</li>
						</ul>
					</div>
					<a class="system_link nav_item" data-detail="desktop">桌面</a>
					<a class="system_link" onclick="refreshIframe();">刷新</a>
					<a class="system_link" onclick="closeAllIframe();">全部关闭</a>
				</div>
				<div class="header_nav">
					<ul class="header_nav_list">
						<li class="header_nav_item light-blue">
							<a data-toggle="dropdown" class="dropdown-toggle header_nav_link">
								<i class="icon-notice header_nav_icon"></i><span class="badge badge-important header_nav_badge">1</span>
							</a>
							<ul class="dropdown-menu dropdown-menu-right">
								<li class="header_notice">
									<a class="header_notice_link">通知：物资系统全新上线！</a>
								</li>
							</ul>
						</li>
						<li class="header_nav_item light-blue">
							<a data-toggle="dropdown" class="dropdown-toggle header_nav_link"><i class="icon-support header_nav_icon"></i>支持</a>
							<ul class="dropdown-menu dropdown-menu-right">
								<li>
									<a>联系方式</a>
								</li>
							</ul>
						</li>
						<li class="header_nav_item light-blue">
							<a data-toggle="dropdown" class="dropdown-toggle header_nav_link">
								<img src="images/user.png" alt="" class="header_user_img">
								<span class="header_user_name">${userName }</span><span class="caret"></span>
							</a>
							<ul class="dropdown-menu dropdown-menu-right">
								<li>
									<a href="javascript:toUpdatePwd()">修改密码</a>
								</li>
								<li>
									<a href="<%=basePath %>logout.do">退出系统</a>
								</li>
							</ul>
						</li>
					</ul>
				</div>
			</header>
			<div class="main clearfix">
				<div class="sidebar">
					<div class="sidebar_name"><i class="icon-menu sidebar_name_icon"></i>目录菜单</div>
					<nav class="asidenav">
						<ul class="asidenav_list">
							<li>
								<a><i class="icon-business asidenav_icon"></i><span class="asidenav_menu_text">业务处理</span><i class="icon-down asidenav_dropdown"></i></a>
								<ul class="asidenav_submenu">
									<li>
										<a class="nav_item" data-detail="purchaseRequest">采购申请</a>
									</li>
									<li>
										<a class="nav_item" data-detail="purchaseAgent">待采购物资</a>
									</li>
									<li>
										<a class="nav_item" data-detail="purchaseOrder">采购订单</a>
									</li>
									<li>
										<a class="nav_item" data-detail="returnRequest">退货申请</a>
									</li>
								</ul>
							</li>
							<li>
								<a><i class="icon-stock-in asidenav_icon"></i><span class="asidenav_menu_text">入库管理</span><i class="icon-down asidenav_dropdown"></i></a>
								<ul class="asidenav_submenu">
									<li>
										<a class="nav_item" data-detail="purchaseStorage">采购入库</a>
									</li>
									<li>
										<a class="nav_item" data-detail="generalStorage">普通入库</a>
									</li>
									<li>
										<a class="nav_item" data-detail="pickingReturn">领料归还</a>
									</li>
								</ul>
							</li>
							<li>
								<a><i class="icon-stock-out asidenav_icon"></i><span class="asidenav_menu_text">出库管理</span><i class="icon-down asidenav_dropdown"></i></a>
								<ul class="asidenav_submenu">
									<li>
										<a class="nav_item" data-detail="returnAgent">待退货物资</a>
									</li>
									<li>
										<a class="nav_item" data-detail="returnOrder">退货出库</a>
									</li>
									<li>
										<a class="nav_item" data-detail="getLeaveStorage">领用出库</a>
									</li>
								</ul>
							</li>
							<li>
								<a><i class="icon-stock asidenav_icon"></i><span class="asidenav_menu_text">库存管理</span><i class="icon-down asidenav_dropdown"></i></a>
								<ul class="asidenav_submenu">
									<li>
										<a class="nav_item" data-detail="storageManage">库存查询</a>
									</li>
									<li>
										<a class="nav_item" data-detail="storageDistribute">库存调配</a>
									</li>
									<li>
										<a class="nav_item" data-detail="storageLoss">库存报损</a>
									</li>
									<li>
										<a class="nav_item" data-detail="storageInventory">库存盘点</a>
									</li>
									<li>
										<a class="nav_item" data-detail="expiryDateWarning">有效期预警</a>
									</li>
									<li>
										<a class="nav_item" data-detail="inventoryWarning">库存预警</a>
									</li>
								</ul>
							</li>
							<li>
								<a><i class="icon-statistics asidenav_icon"></i><span class="asidenav_menu_text">系统统计</span><i class="icon-down asidenav_dropdown"></i></a>
								<ul class="asidenav_submenu">
									<li>
										<a class="nav_item" data-detail="purchaseReport">物品采购统计表</a>
									</li>
									<li>
										<a class="nav_item" data-detail="storageReport">物品入库统计表</a>
									</li>
									<li>
										<a class="nav_item" data-detail="inventoryReport">物品盘点统计表</a>
									</li>
									<li>
										<a class="nav_item" data-detail="lossReport">物品报损统计表</a>
									</li>
									<li>
										<a class="nav_item" data-detail="pickingReport">物品领用统计表</a>
									</li>
									<li>
										<a class="nav_item" data-detail="returnReport">物品退货统计表</a>
									</li>
								</ul>
							</li>
							<li>
								<a><i class="icon-approval asidenav_icon"></i><span class="asidenav_menu_text">审批管理</span><i class="icon-down asidenav_dropdown"></i></a>
								<ul class="asidenav_submenu">
									<li>
										<a class="nav_item" data-detail="purchaseRequestApprove">采购申请审批</a>
									</li>
									<li>
										<a class="nav_item" data-detail="purchaseOrderApprove">采购订单审批</a>
									</li>
									<li>
										<a class="nav_item" data-detail="returnOrderApprove">退货申请审批</a>
									</li>
									<li>
										<a class="nav_item" data-detail="mySubmittedApprove">我提交的审批</a>
									</li>
									<li>
										<a class="nav_item" data-detail="approveByMe">我审批的审批</a>
									</li>
								</ul>
							</li>
							<li>
								<a><i class="icon-data asidenav_icon"></i><span class="asidenav_menu_text">基础数据</span><i class="icon-down asidenav_dropdown"></i></a>
								<ul class="asidenav_submenu">
									<li>
										<a class="nav_item" data-detail="goodsManage">物品管理</a>
									</li>
									<li>
										<a class="nav_item" data-detail="goodsType">物品分类</a>
									</li>
									<li>
										<a class="nav_item" data-detail="supplierManage">供应商管理</a>
									</li>
									<li>
										<a class="nav_item" data-detail="supplyAgreement">供货协议</a>
									</li>
									<li>
										<a class="nav_item" data-detail="shopManage">店仓管理</a>
									</li>
									<li>
										<a class="nav_item" data-detail="warehouseManage">仓库管理</a>
									</li>
									<li>
										<a class="nav_item" data-detail="inventoryLocationManage">库位管理</a>
									</li>
								</ul>
							</li>
							<li>
								<a><i class="icon-setting asidenav_icon"></i><span class="asidenav_menu_text">系统设置</span><i class="icon-down asidenav_dropdown"></i></a>
								<ul class="asidenav_submenu">
									<li>
										<a class="nav_item" data-detail="userManage">用户管理</a>
									</li>
									<li>
										<a class="nav_item" data-detail="roleManage">角色管理</a>
									</li>
									<li>
										<a class="nav_item" data-detail="jurisdictionManage">权限管理</a>
									</li>
									<li>
										<a class="nav_item" data-detail="auditFlow">审批流程</a>
									</li>
								</ul>
							</li>
						</ul>
					</nav>
					<a class="sidebar_toggle"></a>
				</div>
				<div class="main_container">
					<div class="tab">
						<div class="tab_head">
						</div>
						<div class="tab_body">
						</div>
					</div>
				</div>
			</div>
			<!-- 	<footer>
			<p>Copyright ©2017 珠海泛网科技有限责任公司 All Rights Reserved.</p>
		</footer> -->
		</div>

		<!-- 修改密码弹出框 -->
		<div class="modal fade" id="selectRole" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
			<div class="modal-dialog" role="document" style="width: 450px;">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close">
					<span aria-hidden="true">&times;</span>
				</button>
						<h4 class="modal-title" id="myModalLabel">修改用户密码</h4>
					</div>
					<div class="tableBox box" style="margin: 20px 0; text-align: center;">
						<div class="row"><span>原密码</span><input type="password" class="input form-control" name="oldPaw"></div>
						<div class="row"><span>新密码</span><input type="password" class="input form-control" name="paw1"></div>
						<div class="row"><span>新密码</span><input type="password" class="input form-control" name="paw2"></div>
					</div>
					<div class="red" id="add_goods_msg" style="text-align: center;"></div>
					<div class="modal-footer">
						<button type="button" class="btn org" style="background-color: rgb(255,183,82);" onclick="updatePwd()">确定</button>
						<button type="button" class="btn org" data-dismiss="modal">取消</button>
					</div>
				</div>
			</div>
		</div>
		<jsp:include page="/jsp/basic/prompt.jsp"></jsp:include>
		<script type="text/javascript">
			var basePath = "<%=basePath %>";
		</script>
		<script src="<%=basePath %>js/jquery-3.2.1.min.js"></script>
		<script src="<%=basePath %>libs/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
		<script src="<%=basePath %>js/public.js"></script>
		<script src="<%=basePath %>js/index.js"></script>
		<script src="<%=basePath %>js/nav.js"></script>
		<script type="text/javascript">
			/* 打开修改密码面板 */
			function toUpdatePwd() {
				$("#selectRole").modal('show');
			}
			/* 执行修改密码 */
			function updatePwd() {
				var oldPaw = $("input[name='oldPaw']").val();
				var paw1 = $("input[name='paw1']").val();
				var paw2 = $("input[name='paw2']").val();

				if(oldPaw.length < 1) {
					Prompt.alert("提示", "请输入原密码");
					return;
				}
				if(paw1.length < 1 || paw2.length < 1) {
					Prompt.alert("提示", "请输入新密码");
					return;
				}
				if(paw1 != paw2) {
					Prompt.alert("提示", "两次新密码输入不一致");
					return;
				}

				$.ajax({
					url: "<%=basePath%>user/updatePwd.do",
					type: "post",
					async: false,
					dataType: "json",
					data: "oldPaw=" + oldPaw + "&paw1=" + paw1,
					success: function(data) {
						/* 0未知错误，1原密码错误，2修改失败，3修改成功 */
						if(data == '0') {
							Prompt.alert("提示", '未知错误，请联系管理员');
						} else if(data == '1') {
							Prompt.alert("提示", '原密码错误');
						} else if(data == '2') {
							Prompt.alert("提示", '修改失败');
						} else if(data == '3') {
							Prompt.alert("提示", '修改成功');
						} else {
							Prompt.alert("提示", '未知错误，请联系管理员');
						}

					},
					error: function() {
						Prompt.alert("删除提示", "服务器无响应，请刷新页面后重试！");
					}
				});
				$("input[name='oldPaw']").val("");
				$("input[name='paw1']").val("");
				$("input[name='paw2']").val("");
				$("#selectRole").modal('hide');
			}
			
			function refreshIframe(){
				var iframe=$(".tab_content.active iframe")[0];
				var href=iframe.contentWindow.location.href;
				iframe.contentWindow.location.href=href;
			}
			
			function closeAllIframe(){
				$(".tab_head .tab_close").click();
			}
			
			window.onresize = function(){
				$("iframe").height($(".page").height() - 65-$(".tab_head").height());
			}
		</script>
	</body>
</html>